<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Hoodoo::Services::Middleware::InterResourceRemote</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/github.css" type="text/css" media="screen" />
<script src="../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>
    <div class="banner">
        <h1>
            <span class="type">Class</span>
            Hoodoo::Services::Middleware::InterResourceRemote
                <span class="parent">&lt;
                    <a href="../../Client/Endpoint.html">Hoodoo::Client::Endpoint</a>
                </span>
        </h1>
        <ul class="files">
            <li><a href="../../../../files/lib/hoodoo/services/middleware/endpoints/inter_resource_remote_rb.html">lib/hoodoo/services/middleware/endpoints/inter_resource_remote.rb</a></li>
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
    <div class="description">
      
<p>This is an endpoint which the middleware uses for inter-resource calls over
another &#39;wrapped&#39; endpoint. This endpoint manages all the
inter-resource preparation and post processing, but calls in to another
wrapped endpoint to actually talk to the resource for which the
inter-resource call is being made.</p>

<p>Since it wraps another endpoint, instantiation requirements are rather
unusual - see <a
href="InterResourceRemote.html#method-i-configure_with">configure_with</a>
for details.</p>

    </div>








    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
        <dt>C</dt>
        <dd>
          <ul>
              <li>
                <a href="#method-i-configure_with">configure_with</a>,
              </li>
              <li>
                <a href="#method-i-create">create</a>
              </li>
          </ul>
        </dd>
        <dt>D</dt>
        <dd>
          <ul>
              <li>
                <a href="#method-i-delete">delete</a>
              </li>
          </ul>
        </dd>
        <dt>L</dt>
        <dd>
          <ul>
              <li>
                <a href="#method-i-list">list</a>
              </li>
          </ul>
        </dd>
        <dt>S</dt>
        <dd>
          <ul>
              <li>
                <a href="#method-i-show">show</a>
              </li>
          </ul>
        </dd>
        <dt>U</dt>
        <dd>
          <ul>
              <li>
                <a href="#method-i-update">update</a>
              </li>
          </ul>
        </dd>
    </dl>










    <!-- Methods -->
      <div class="sectiontitle">Instance Public methods</div>
        <div class="method">
          <div class="title method-title" id="method-i-create">
              <b>create</b>( body_hash, query_hash = nil )
            <a href="../../../../classes/Hoodoo/Services/Middleware/InterResourceRemote.html#method-i-create" name="method-i-create" class="permalink">Link</a>
          </div>

            <div class="description">
              <p>See <a
href="../../Client/Endpoint.html#method-i-create">Hoodoo::Client::Endpoint#create</a>.</p>
            </div>



            <div class="sourcecode">
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-create_source')" id="l_method-i-create_source">show</a>
              </p>
              <div id="method-i-create_source" class="dyn-source">
                <pre><span class="ruby-comment"># File lib/hoodoo/services/middleware/endpoints/inter_resource_remote.rb, line 87</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">create</span>( <span class="ruby-identifier">body_hash</span>, <span class="ruby-identifier">query_hash</span> = <span class="ruby-keyword">nil</span> )
  <span class="ruby-identifier">result</span> = <span class="ruby-identifier">preprocess</span>( <span class="ruby-value">:create</span> )
  <span class="ruby-identifier">result</span> = <span class="ruby-ivar">@wrapped_endpoint</span>.<span class="ruby-identifier">create</span>( <span class="ruby-identifier">body_hash</span>, <span class="ruby-identifier">query_hash</span> ) <span class="ruby-keyword">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">nil?</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">postprocess</span>( <span class="ruby-identifier">result</span> )
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
          </div>
        <div class="method">
          <div class="title method-title" id="method-i-delete">
              <b>delete</b>( ident, query_hash = nil )
            <a href="../../../../classes/Hoodoo/Services/Middleware/InterResourceRemote.html#method-i-delete" name="method-i-delete" class="permalink">Link</a>
          </div>

            <div class="description">
              <p>See <a
href="../../Client/Endpoint.html#method-i-delete">Hoodoo::Client::Endpoint#delete</a>.</p>
            </div>



            <div class="sourcecode">
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-delete_source')" id="l_method-i-delete_source">show</a>
              </p>
              <div id="method-i-delete_source" class="dyn-source">
                <pre><span class="ruby-comment"># File lib/hoodoo/services/middleware/endpoints/inter_resource_remote.rb, line 103</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">delete</span>( <span class="ruby-identifier">ident</span>, <span class="ruby-identifier">query_hash</span> = <span class="ruby-keyword">nil</span> )
  <span class="ruby-identifier">result</span> = <span class="ruby-identifier">preprocess</span>( <span class="ruby-value">:delete</span> )
  <span class="ruby-identifier">result</span> = <span class="ruby-ivar">@wrapped_endpoint</span>.<span class="ruby-identifier">delete</span>( <span class="ruby-identifier">ident</span>, <span class="ruby-identifier">query_hash</span> ) <span class="ruby-keyword">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">nil?</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">postprocess</span>( <span class="ruby-identifier">result</span> )
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
          </div>
        <div class="method">
          <div class="title method-title" id="method-i-list">
              <b>list</b>( query_hash = nil )
            <a href="../../../../classes/Hoodoo/Services/Middleware/InterResourceRemote.html#method-i-list" name="method-i-list" class="permalink">Link</a>
          </div>

            <div class="description">
              <p>See <a
href="../../Client/Endpoint.html#method-i-list">Hoodoo::Client::Endpoint#list</a>.</p>
            </div>



            <div class="sourcecode">
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-list_source')" id="l_method-i-list_source">show</a>
              </p>
              <div id="method-i-list_source" class="dyn-source">
                <pre><span class="ruby-comment"># File lib/hoodoo/services/middleware/endpoints/inter_resource_remote.rb, line 71</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">list</span>( <span class="ruby-identifier">query_hash</span> = <span class="ruby-keyword">nil</span> )
  <span class="ruby-identifier">result</span> = <span class="ruby-identifier">preprocess</span>( <span class="ruby-value">:list</span> )
  <span class="ruby-identifier">result</span> = <span class="ruby-ivar">@wrapped_endpoint</span>.<span class="ruby-identifier">list</span>( <span class="ruby-identifier">query_hash</span> ) <span class="ruby-keyword">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">nil?</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">inject_enumeration_state</span>( <span class="ruby-identifier">postprocess</span>( <span class="ruby-identifier">result</span> ), <span class="ruby-identifier">query_hash</span> )
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
          </div>
        <div class="method">
          <div class="title method-title" id="method-i-show">
              <b>show</b>( ident, query_hash = nil )
            <a href="../../../../classes/Hoodoo/Services/Middleware/InterResourceRemote.html#method-i-show" name="method-i-show" class="permalink">Link</a>
          </div>

            <div class="description">
              <p>See <a
href="../../Client/Endpoint.html#method-i-show">Hoodoo::Client::Endpoint#show</a>.</p>
            </div>



            <div class="sourcecode">
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-show_source')" id="l_method-i-show_source">show</a>
              </p>
              <div id="method-i-show_source" class="dyn-source">
                <pre><span class="ruby-comment"># File lib/hoodoo/services/middleware/endpoints/inter_resource_remote.rb, line 79</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">show</span>( <span class="ruby-identifier">ident</span>, <span class="ruby-identifier">query_hash</span> = <span class="ruby-keyword">nil</span> )
  <span class="ruby-identifier">result</span> = <span class="ruby-identifier">preprocess</span>( <span class="ruby-value">:show</span> )
  <span class="ruby-identifier">result</span> = <span class="ruby-ivar">@wrapped_endpoint</span>.<span class="ruby-identifier">show</span>( <span class="ruby-identifier">ident</span>, <span class="ruby-identifier">query_hash</span> ) <span class="ruby-keyword">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">nil?</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">postprocess</span>( <span class="ruby-identifier">result</span> )
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
          </div>
        <div class="method">
          <div class="title method-title" id="method-i-update">
              <b>update</b>( ident, body_hash, query_hash = nil )
            <a href="../../../../classes/Hoodoo/Services/Middleware/InterResourceRemote.html#method-i-update" name="method-i-update" class="permalink">Link</a>
          </div>

            <div class="description">
              <p>See <a
href="../../Client/Endpoint.html#method-i-update">Hoodoo::Client::Endpoint#update</a>.</p>
            </div>



            <div class="sourcecode">
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-update_source')" id="l_method-i-update_source">show</a>
              </p>
              <div id="method-i-update_source" class="dyn-source">
                <pre><span class="ruby-comment"># File lib/hoodoo/services/middleware/endpoints/inter_resource_remote.rb, line 95</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">update</span>( <span class="ruby-identifier">ident</span>, <span class="ruby-identifier">body_hash</span>, <span class="ruby-identifier">query_hash</span> = <span class="ruby-keyword">nil</span> )
  <span class="ruby-identifier">result</span> = <span class="ruby-identifier">preprocess</span>( <span class="ruby-value">:update</span> )
  <span class="ruby-identifier">result</span> = <span class="ruby-ivar">@wrapped_endpoint</span>.<span class="ruby-identifier">update</span>( <span class="ruby-identifier">ident</span>, <span class="ruby-identifier">body_hash</span>, <span class="ruby-identifier">query_hash</span> ) <span class="ruby-keyword">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">nil?</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">postprocess</span>( <span class="ruby-identifier">result</span> )
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
          </div>
      <div class="sectiontitle">Instance Protected methods</div>
        <div class="method">
          <div class="title method-title" id="method-i-configure_with">
              <b>configure_with</b>( resource, version, options )
            <a href="../../../../classes/Hoodoo/Services/Middleware/InterResourceRemote.html#method-i-configure_with" name="method-i-configure_with" class="permalink">Link</a>
          </div>

            <div class="description">
              <p>See <a
href="../../Client/Endpoint.html#method-i-configure_with">Hoodoo::Client::Endpoint#configure_with</a>.</p>

<p>It isn&#39;t expected that anyone will ever need to use this class beyond
<a href="../Middleware.html">Hoodoo::Services::Middleware</a>, but you
never know…</p>

<p>Configuration option keys which <em>must</em> be supplied are:</p>
<dl class="rdoc-list note-list"><dt><code>interaction</code>
<dd>
<p>A <a href="Interaction.html">Hoodoo::Services::Middleware::Interaction</a>
instance which describes the <strong>source</strong> interaction at hand.
This is a middleware concept; the middleware is handling some API call
which the source interaction data describes, but the resource which is
handling the call needs to make a remote inter-resource call, which is why
this Endpoint subclass instance is needed.</p>
</dd><dt><code>discovery_result</code>
<dd>
<p>A <a
href="../Discovery/ForRemote.html">Hoodoo::Services::Discovery::ForRemote</a>
instance describing the remotely available resource endpoint.</p>
</dd></dl>

<p>The pattern for creating and using this instance is:</p>
<ul><li>
<p>Use the discovery result to build an appropriate Endpoint subclass
instance, e.g. <a
href="../../Client/Endpoint/HTTP.html">Hoodoo::Client::Endpoint::HTTP</a>.</p>
</li><li>
<p>Create a <a
href="../Discovery/ForRemote.html">Hoodoo::Services::Discovery::ForRemote</a>
instance which describes the above endpoint via the
<code>wrapped_endpoint</code> option.</p>
</li><li>
<p>Build an instance of this auto-session Endpoint subclass, giving it the
above object as the <code>discovery_result</code>.</p>
</li><li>
<p>Use this endpoint in the normal fashion. All the special mechanics of
remote inter-resource calling are handled here.</p>
</li></ul>
            </div>



            <div class="sourcecode">
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-configure_with_source')" id="l_method-i-configure_with_source">show</a>
              </p>
              <div id="method-i-configure_with_source" class="dyn-source">
                <pre><span class="ruby-comment"># File lib/hoodoo/services/middleware/endpoints/inter_resource_remote.rb, line 63</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">configure_with</span>( <span class="ruby-identifier">resource</span>, <span class="ruby-identifier">version</span>, <span class="ruby-identifier">options</span> )
  <span class="ruby-ivar">@wrapped_endpoint</span> = <span class="ruby-ivar">@discovery_result</span>.<span class="ruby-identifier">wrapped_endpoint</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
          </div>
</div>

    </div>
  </body>
</html>
